package com.orhon.smartcampus.modules.schoolaffairs.InputMapper;


import com.alibaba.fastjson.JSON;
import com.orhon.smartcampus.basicComponents.ConvertHelper;
import com.orhon.smartcampus.modules.schoolaffairs.gqlInputModel.GQLSchoolFormulaInput;
import com.orhon.smartcampus.modules.schoolaffairs.gqlInputModel.GQLSchoolOpinionInput;
import com.orhon.smartcampus.modules.schoolaffairs.gqlModel.GQLSchoolFormula;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.Map;

@Mapper(uses = {
        ConvertHelper.class
})
public interface SchoolFormulaInputMapper {

    SchoolFormulaInputMapper MAPPER = Mappers.getMapper(SchoolFormulaInputMapper.class);

    default GQLSchoolFormulaInput mapInput(final Map map){
        String json = JSON.toJSONString(map);
        GQLSchoolFormulaInput input = JSON.parseObject(json , GQLSchoolFormulaInput.class);
        return input;
    }

}
